package com.sx.manage.controller.report;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sx.manage.controller.base.MBaseController;
import com.sx.manage.service.report.MReposrWebServiceImpl;
import com.sx.manage.servlet.ViewAndModel;
import com.sx.model.constants.MSystemConstants;
import com.sx.model.constants.type.MUrlType;
import com.sx.model.manage.mybatis.vo.auth.MAutoVO;

/**
 * 报表系统controller
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/report")
public class MRepotController extends MBaseController  {
	private Logger _log = LoggerFactory.getLogger(this.getClass());

	@Resource(name="reposrWebServiceImpl")
	private MReposrWebServiceImpl reposrWebServiceImpl;

	
	/**渠道跳转*/
	@RequestMapping(value="/manage_channel/{url_str}")
	public ViewAndModel manage_channel (@PathVariable String url_str,HttpServletRequest request,HttpServletResponse response) {
		_log.debug("渠道跳转");
		ViewAndModel model = new ViewAndModel("report/manage_company",request,cache);

					 MAutoVO authVO = reposrWebServiceImpl.encrypt( this.loginConsumer(MUrlType.MODEL_AND_VIEW_URL),MSystemConstants.REPORT_MANAGE_CHANNEL+"/"+url_str);
					 model.addObject("url_str", authVO.getAuth_str());
		_log.debug("authVO.url_str"+authVO.getAuth_str());
					 return model;
	}
	/**公司跳转*/
	@RequestMapping(value="/manage_company/{url_str}")
	public ViewAndModel manage_company (@PathVariable String url_str,HttpServletRequest request,HttpServletResponse response) {
		_log.debug("公司跳转");
		ViewAndModel model = new ViewAndModel("report/manage_company",request,cache);

					 MAutoVO authVO = reposrWebServiceImpl.encrypt(this.loginConsumer(MUrlType.MODEL_AND_VIEW_URL),
							 MSystemConstants.REPORT_MANAGE_COMPANY+"/"+url_str);
					 model.addObject("url_str", authVO.getAuth_str());
		_log.debug("authVO.url_str"+authVO.getAuth_str());
					 return model;
	}
	/**后台跳转*/
	@RequestMapping(value="/manage_payroll/{url_str}")
	public ViewAndModel manage_payroll (@PathVariable String url_str,HttpServletRequest request,HttpServletResponse response) {
		_log.debug("后台跳转");
		ViewAndModel model = new ViewAndModel("report/manage_company",request,cache);

					 MAutoVO authVO = reposrWebServiceImpl.encrypt(this.loginConsumer(MUrlType.MODEL_AND_VIEW_URL),
							 MSystemConstants.REPORT_MANAGE_PAYROLL+"/"+url_str);
					 model.addObject("url_str", authVO.getAuth_str());
		_log.debug("authVO.url_str"+authVO.getAuth_str());
					 return model;
	}
	
}
